package com.ccom.base.controller;

import com.ccom.api.domain.SysLoginLog;
import com.ccom.api.domain.SysOperLog;
import com.ccom.base.service.SysLoginLogService;
import com.ccom.base.service.SysOperLogService;
import com.ccom.core.common.constant.ServiceNameConstants;
import com.ccom.core.common.model.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zjj
 * @date 2021/10/9 15:43
 * @description
 */
@Slf4j
@Api(tags = "日志接口")
@RestController
@RequestMapping(ServiceNameConstants.BASE_SERVICE_URL_PREFIX + "/log")
public class SysLogController {

    @Autowired
    private SysLoginLogService sysLoginLogService;

    @Autowired
    private SysOperLogService sysOperLogService;

    @ApiOperation(value = "添加用户操作日志接口")
    @PostMapping("/saveOperLog")
    public Result<Boolean> saveOperLog(@RequestBody SysOperLog sysOperLog) {
        return sysOperLogService.saveOperLog(sysOperLog);
    }

    @ApiOperation(value = "添加用户登录日志接口")
    @PostMapping("/saveLoginLog")
    public Result<Boolean> saveLoginLog(@RequestBody SysLoginLog sysLoginLog) {
        return sysLoginLogService.saveLoginLog(sysLoginLog);
    }

}
